<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 暴力枚举
        function fn(nums, target) {
            for (var i = 0; i < nums.length; i++) {
                for (let j = i + 1; j < nums.length; j++) {
                    if (nums[i] + nums[j] == target) {
                        return [i, j]
                    }

                }
            }
        }

        // 哈希表
        function bar(nums, target) {
            var map = new Map();
            for (var i = 0; i < nusm.length; i++) {
                if (map.has(target - nums[i])) {
                    return [map.get(targtet - nums[i], i)]
                }
                map.set(nums[i], i)
            }
            return null
        }

    </script>
</body>

</html>